package com.qf.homework2.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("/usersd")
public class UserController {

    @RequestMapping("/exist")
    public void existUser(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=UTF-8");
        String value = req.getParameter("value");
        String result =null;
        if (value.equals("root")|value.equals("admin")){
            result="2";
        }else {result="1";}
        resp.getWriter().println(result);
    }
    @RequestMapping("/no1")
    public String no1(){
        System.out.println("jinlaile");
        return "hi.html";
    }
}
